<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href='/css/styles.css' rel='stylesheet' type='text/css' />
    <link href='/images/favicon.png' rel='shortcut icon' />
    <script src='/js/jquery.min.1.4.js'></script>
    <script src='/js/app.js'></script>
    <script src='/js/common.js'></script>
    
    <meta content='width=device-width, minimum-scale=1.0, maximum-scale=1.0' name='viewport' />
    <title>redis - 命令</title>
	<meta http-equiv="description" content="redis中文资料站，下载安装redis，查找redis常用命令（commands），选择适合的redis客户端方式，配置redis主从（master-slave），阅读redis官方文档，社区里了解更多redis信息，提交redis的bug。" />
	
  </head>
  <body class=''>
    <script src='/js/head.js'></script>
    <div class='text'>
      <h1 class='command'>
        <span id='command_name_span' class='name'></span>
        <span id='command_args_span' class='arg'></span>
      </h1>
      <article>
      	<aside>
        	<script type='text/javascript'>showCmdURL();</script>
        </aside>
        
        <div class='metadata'>
          <p><strong>加入版本 <span id='command_ver_span'></span>。</strong></p>
          <p><strong>时间复杂度：</strong> O(1)。</p>
        </div>
        
        <p>Increment the string representing a floating point number stored at <code>key</code> by the
        specified <code>increment</code>.
        If the key does not exist, it is set to <code>0</code> before performing the operation.
        An error is returned if one of the following conditions occur:</p>
        
        <ul>
        <li>The key contains a value of the wrong type (not a string).</li>
        <li>The current key content or the specified increment are not parsable as a
        double precision floating point number.</li>
        </ul>
        
        <p>If the command is successful the new incremented value is stored as the new
        value of the key (replacing the old one), and returned to the caller as a
        string.</p>
        
        <p>Both the value already contained in the string key and the increment argument
        can be optionally provided in exponential notation, however the value computed
        after the increment is stored consistently in the same format, that is, an
        integer number followed (if needed) by a dot, and a variable number of digits
        representing the decimal part of the number.
        Trailing zeroes are always removed.</p>
        
        <p>The precision of the output is fixed at 17 digits after the decimal point
        regardless of the actual internal precision of the computation.</p>
        
        <h2>Return value</h2>
        
        <p><a href="/topics/protocol.html#bulk-reply">Bulk reply</a>: the value of <code>key</code> after the increment.</p>
        
        <h2>Examples</h2>
        
        <div class='example' data-session='a57ab094dc7f5a18cba9edacad49895b'>
          <span class='monospace prompt'>redis&gt;&nbsp;</span>
          <span class='monospace command'>SET mykey 10.50</span>
          <pre>OK</pre>
          <span class='monospace prompt'>redis&gt;&nbsp;</span>
          <span class='monospace command'>INCRBYFLOAT mykey 0.1</span>
          <pre>"10.6"</pre>
          <span class='monospace prompt'>redis&gt;&nbsp;</span>
          <span class='monospace command'>SET mykey 5.0e3</span>
          <pre>OK</pre>
          <span class='monospace prompt'>redis&gt;&nbsp;</span>
          <span class='monospace command'>INCRBYFLOAT mykey 2.0e2</span>
          <pre>"5200"</pre><form>
            <span class='monospace prompt'>redis&gt;&nbsp;</span>
            <input autocomplete='off' name='command' spellcheck='false' type='text' />
          </form></div>
        
        
        <h2>Implementation details</h2>
        
        <p>The command is always propagated in the replication link and the Append Only
        File as a <a href="/commands/set.html">SET</a> operation, so that differences in the underlying floating point
        math implementation will not be sources of inconsistency.</p>
        
      </article>
    </div>
    <script type='text/javascript'>startShow();</script>
    <div class='text' id='comments'>
      <div id='disqus_thread'></div>
      <script type='text/javascript'>
        //<![CDATA[
          var disqus_shortname = 'rediscn';
          
          // The following are highly recommended additional parameters. Remove the slashes in front to use.
          var disqus_identifier = 'command_'+curCommandObj.key;
          var disqus_url = curCommandObj.getdisqusUrl();  // = 'http://redis.cn/commands/'+curCommandObj.key;
          
          /* * * DON'T EDIT BELOW THIS LINE * * */
          (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
              dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
              (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
          })();
        //]]>
      </script>
      <a class='dsq-brlink' href='http://disqus.com'>
        Comments powered by
        <span class='logo-disqus'>
          Disqus
        </span>
      </a>
    </div>

    
    <script src='/js/foot.js'></script>
    
  </body>
</html>
